# Importing Data
INDIA <- read_excel("C:/Users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "N1:N239")

# Checking the Imported Data
View(INDIA)
# Creating Time Series Data
INDIA_ts <- ts(INDIA, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
INDIA_ts
sum(is.na(INDIA_ts))
library(forecast)
INDIA_ts <- tsclean(INDIA_ts)
INDIA_ts

# Identification: Plotting the Time Series Data
plot(INDIA_ts)

# Estimating the appropriate model
INDIA_ts_model <- auto.arima(INDIA_ts)
INDIA_ts_model

# Forecasting
options(max.print=1000000)
INDIA_ts_forecast <- forecast (INDIA_ts_model, level=c(95), h=255)
plot(INDIA_ts_forecast)
INDIA_ts_forecast             

# Exporting
write.table(INDIA_ts_forecast, file="/Users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/India_TSA.csv", sep=",")
